import { createSlice } from '@reduxjs/toolkit';

export const counterSlice = createSlice({
  name: 'counter',
  initialState: {
    value: 0,
    show: false,
    Nrs: null,
    Footers: null,
    title: '',
    heiddenClose: false,
    TitleCom: null
  },
  reducers: {
    setShow: (state, action) => {
      state.show = action.payload.show
      if (!action.payload.show) return
      const { Nrs, Footers, title, heiddenClose, TitleCom } = action.payload
      state.Nrs = Object.freeze(Nrs)
      state.Footers = Object.freeze(Footers)
      state.title = title
      state.heiddenClose = heiddenClose
      state.TitleCom = TitleCom
    }
  },
})
// 为每个 case reducer 函数生成 Action creators
export const { setShow } = counterSlice.actions;

export default counterSlice.reducer;
